package cn.iocoder.yudao.module.wms.dal.mysql.commodity;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.wms.controller.admin.commodity.vo.CommodityPageReqVO;
import cn.iocoder.yudao.module.wms.dal.dataobject.commodity.CommodityDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 商品 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CommodityMapper extends BaseMapperX<CommodityDO> {

    default PageResult<CommodityDO> selectPage(CommodityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CommodityDO>()
                // .eqIfPresent(CommodityDO::getCount, reqVO.getCount())
                // .eqIfPresent(CommodityDO::getCreateAt, reqVO.getCreateAt())
                // .eqIfPresent(CommodityDO::getDescription, reqVO.getDescription())
                .likeIfPresent(CommodityDO::getName, reqVO.getName())
                // .eqIfPresent(CommodityDO::getPrice, reqVO.getPrice())
                // .eqIfPresent(CommodityDO::getUpdateAt, reqVO.getUpdateAt())
                .orderByDesc(CommodityDO::getUpdateAt));
    }

}